#ifndef _SINGLETON_HPP_
#define _SINGLETON_HPP_
//单例模式基类，其他类可继承此基类来使用单例模式

template <typename T>
class Singleton{

public:
    Singleton(const Singleton&) = delete;
    Singleton& operator=(const Singleton&) = delete;

    static T& instance(){
        static T instance;
        return instance;
    }

protected:
    Singleton() = default;
    virtual ~Singleton() = default;
};
#define INSTANCE(class_name) Singleton<class_name>::instance()

#endif